<?php
declare(strict_types=1);
namespace app\index\widget;
use aphp\core\Widget;
class Doc extends Widget
{
    protected string $tag = 'doc';
    protected int $expire = 0;
    public function set($id = '', array $options = [])
    {
        if (empty($id)) {
            return db('doc')->where('status=1')->order('sort ASC,id ASC')->column('title', 'id');
        }
        $data = db('doc')->where('id', $id)->where('status=1')->find();
        if (!empty($data)) {
            $data['start_id'] = get_start_id($data['id']);
            return $data;
        }
        return [];
    }
}